# Author: Yu Bin
# Date: 2025/01/03 16:19:52
# E-mail: 853823259@qq.com
import re


def use_greedy():
    s = "This is a number 234-235-22-423"
    r = re.match(r".+(\d+-\d+-\d+-\d+)", s)
    print(r.group(1))
    r = re.match(r".+?(\d+-\d+-\d+-\d+)", s)
    print(r.group(1))


def use_r():
    mm = "c:\\a\\b\\c"
    ret = re.match("c:\\\\", mm).group()
    print(ret)
    ret = re.match(r"c:\\", mm).group()
    print(ret)
    ret = re.match("c:\\\\a", mm).group()
    print(ret)
    ret = re.match(r"c:\\a", mm).group()
    print(ret)


def use_option():
    print(re.match(r'\w*', 'abc你好', flags=re.A).group())
    print(re.match(r'a*', 'abcABC', flags=re.I).group())
    print(re.match(r'.*', 'abc\ndef', flags=re.S).group())


if __name__ == '__main__':
    # use_greedy()
    # use_r()
    use_option()
